package com.shrct.businessprocess.product.impl;

import com.shrct.businessprocess.product.RCActualServicePurchased;
import com.shrct.businessprocess.product.RCFullServiceProductEntry;
import com.shrct.businessprocess.product.RCProductServiceTracer;
import com.shrct.businessprocess.product.impl.RCFullServiceProductEntryImpl;
import com.shrct.businessprocess.product.impl.RCProductServiceTracerImpl;
import com.shrct.businessprocess.product.proxy.RCActualServicePurchasedProxy;
import edu.fudan.mylang.pf.BaseModelObject;
import edu.fudan.mylang.pf.IObjectFactory;
import java.util.Date;
import javax.persistence.CascadeType;
import javax.persistence.DiscriminatorColumn;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import org.eclipse.xtext.xbase.lib.Procedures.Procedure1;
import org.hibernate.annotations.DiscriminatorOptions;

@Entity
@DiscriminatorValue("RCACTUALSERVICEPURCHASED_TYPE")
@DiscriminatorOptions(force = true)
@DiscriminatorColumn(length = 64)
@Table(name = "rcactualservicepurchased")
public class RCActualServicePurchasedImpl extends BaseModelObject implements RCActualServicePurchased {
  public RCActualServicePurchasedImpl() {
    super();
  }
  
  public RCActualServicePurchasedImpl(final RCProductServiceTracer tracer) {
    super();
    this.tracer = tracer;
  }
  
  @JoinColumn(name = "tracer_id")
  @ManyToOne(targetEntity = RCProductServiceTracerImpl.class, cascade = { CascadeType.MERGE, CascadeType.PERSIST })
  private RCProductServiceTracer tracer;
  
  public RCProductServiceTracer getTracer() {
    return this.tracer;
  }
  
  public RCActualServicePurchased setTracer(final RCProductServiceTracer tracer) {
    this.tracer = tracer;
    return this;			
    
  }
  
  @JoinColumn(name = "fullService_id")
  @ManyToOne(targetEntity = RCFullServiceProductEntryImpl.class, cascade = { CascadeType.MERGE, CascadeType.PERSIST })
  private RCFullServiceProductEntry fullService;
  
  public RCFullServiceProductEntry getFullService() {
    return this.fullService;
  }
  
  public RCActualServicePurchased setFullService(final RCFullServiceProductEntry fullService) {
    this.fullService = fullService;
    return this;			
    
  }
  
  private Date importDate;
  
  public Date getImportDate() {
    return this.importDate;
  }
  
  public RCActualServicePurchased setImportDate(final Date importDate) {
    this.importDate = importDate;
    return this;			
    
  }
  
  public static RCActualServicePurchased create(final RCProductServiceTracer tracer, final IObjectFactory objectFactory) {
    com.shrct.businessprocess.product.RCActualServicePurchased rCActualServicePurchased = new com.shrct.businessprocess.product.impl.RCActualServicePurchasedImpl(
    	tracer
    );
    objectFactory.create(rCActualServicePurchased);
    return rCActualServicePurchased;			
    
  }
  
  public static RCActualServicePurchased createRCActualServicePurchasedImpl(final RCProductServiceTracer tracer, final IObjectFactory objectFactory, final Procedure1<RCActualServicePurchased> init) {
    com.shrct.businessprocess.product.RCActualServicePurchased rCActualServicePurchased = new com.shrct.businessprocess.product.impl.RCActualServicePurchasedImpl(
    	tracer
    );
    objectFactory.create(rCActualServicePurchased);
    init.apply(rCActualServicePurchased);
    
    return rCActualServicePurchased;			
    
  }
  
  public RCActualServicePurchasedProxy toProxy() {
    com.shrct.businessprocess.product.proxy.RCActualServicePurchasedProxy proxy = new com.shrct.businessprocess.product.proxy.RCActualServicePurchasedProxy();
    proxy.setId(this.getId());
    if(this instanceof edu.fudan.mylang.pf.INamedModelObject){
    	proxy.setName(((edu.fudan.mylang.pf.INamedModelObject)this).getEntityName());
    }
    return proxy;
    
  }
}
